/*
 * Copyright (C) 2015 Daniel Uppenkamp
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.googlecode.maurersmarbles;

import com.google.common.base.Preconditions;

/**
 *
 * @author Daniel Uppenkamp
 */
public abstract class ScreenCanvas {

    /**
     * Draws an oval with the given color.
     *
     * @param rectangle the rectangle to draw the oval in
     * @param rgb the color
     */
    public void drawOval(Rectangle rectangle, int rgb) {
        Preconditions.checkNotNull(rectangle, "Null rectangle");
        drawOval(rectangle.getX(), rectangle.getY(), rectangle.getWidth(), rectangle.getHeight(), rgb);
    }

    /**
     * Draws a rectangle with the given color.
     *
     * @param rectangle the rectangle to draw
     * @param rgb the color
     */
    public void drawRect(Rectangle rectangle, int rgb) {
        Preconditions.checkNotNull(rectangle, "Null rectangle");
        drawRect(rectangle.getX(), rectangle.getY(), rectangle.getWidth(), rectangle.getHeight(), rgb);
    }

    /**
     * Draws a round rectangle with the given color.
     *
     * @param rectangle the rectangle to draw
     * @param arcWidth the arc width of the rounded corners
     * @param arcHeight the arc height of the rounded corners
     * @param rgb the color
     */
    public void drawRoundRect(Rectangle rectangle, int arcWidth, int arcHeight, int rgb) {
        Preconditions.checkNotNull(rectangle, "Null rectangle");
        drawRoundRect(rectangle.getX(), rectangle.getY(), rectangle.getWidth(), rectangle.getHeight(), arcWidth, arcHeight, rgb);
    }

    /**
     * Draws the given string centered with the given color.
     *
     * @param string the string
     * @param rectangle the rectangle to draw the string in
     * @param rgb the color
     */
    public void drawStringCentered(String string, Rectangle rectangle, int rgb) {
        Preconditions.checkNotNull(string, "Null string");
        Preconditions.checkNotNull(rectangle, "Null rectangle");
        drawStringCentered(string, rectangle.getX(), rectangle.getY(), rectangle.getWidth(), rectangle.getHeight(), rgb);
    }

    /**
     * Fills an oval with the given color.
     *
     * @param rectangle the rectangle to draw the oval in
     * @param rgb the color
     */
    public void fillOval(Rectangle rectangle, int rgb) {
        Preconditions.checkNotNull(rectangle, "Null rectangle");
        fillOval(rectangle.getX(), rectangle.getY(), rectangle.getWidth(), rectangle.getHeight(), rgb);
    }

    /**
     * Fills a rectangle with the given color.
     *
     * @param rectangle the rectangle to draw
     * @param rgb the color
     */
    public void fillRect(Rectangle rectangle, int rgb) {
        Preconditions.checkNotNull(rectangle, "Null rectangle");
        fillRect(rectangle.getX(), rectangle.getY(), rectangle.getWidth(), rectangle.getHeight(), rgb);
    }

    /**
     * Fills a round rectangle with the given color.
     *
     * @param rectangle the rectangle to draw
     * @param arcWidth the arc width of the rounded corners
     * @param arcHeight the arc height of the rounded corners
     * @param rgb the color
     */
    public void fillRoundRect(Rectangle rectangle, int arcWidth, int arcHeight, int rgb) {
        Preconditions.checkNotNull(rectangle, "Null rectangle");
        fillRoundRect(rectangle.getX(), rectangle.getY(), rectangle.getWidth(), rectangle.getHeight(), arcWidth, arcHeight, rgb);
    }

    /**
     * Draws a line from x1, y1 to x2, y2 with the given color.
     *
     * @param x1 the x coordinate of the first point
     * @param y1 the y coordinate of the first point
     * @param x2 the x coordinate of the second point
     * @param y2 the y coordinate of the second point
     * @param rgb the color of the line
     */
    public abstract void drawLine(int x1, int y1, int x2, int y2, int rgb);

    /**
     * Draws an oval defined by the given bounding box and with the given color.
     *
     * @param x the upper left x coordinate of the bounding box
     * @param y the upper left y coordinate of the bounding box
     * @param width the width
     * @param height the height
     * @param rgb the color
     */
    public abstract void drawOval(int x, int y, int width, int height, int rgb);

    public abstract void drawRect(int x, int y, int width, int height, int rgb);

    public abstract void drawRoundRect(int x, int y, int width, int height, int arcWidth, int argHeight, int rgb);

    public abstract void drawStringCentered(String string, int x, int y, int width, int height, int rgb);

    public abstract void fillOval(int x, int y, int width, int height, int rgb);

    public abstract void fillRect(int x, int y, int width, int height, int rgb);

    public abstract void fillRoundRect(int x, int y, int width, int height, int arcWidth, int argHeight, int rgb);

}
